package com.surface.hao.util;

import java.util.Collection;

/**
 * @Description: 集合工具类
 * @Author: songhao
 * @Email:425008064@qq.com
 * @CreateDate: 2019/12/30 9:46
 */
public class CollectionUtils {


    /**
     * 将一个集合转换为一个字符串
     * @param contentList
     * @param delimiter
     * @return
     */
    public static String join(Collection<String> contentList,String delimiter){
        StringBuilder builder = new StringBuilder();
        if(contentList == null || contentList.size() == 0 ){
            return builder.toString();
        }
        for(String content : contentList){
            builder.append(content);
            builder.append(delimiter);
        }
        return builder.toString();
    }
}
